import os
from ultralytics import YOLO

import time

if __name__ == '__main__':
    # 读取模型
    model = YOLO(r"C:\Users\64531\Desktop\yolov11\weights\best.pt")

    # 指定输入和输出文件夹或图片路径
    input_folder = r"./123.jpg"

    # model.to(device)
    model.predict(source=0,
                  save=True,
                  show=True,)
    t1 = time.time()
    # metrics = model.predict(source=input_folder,
    #                         save=True,
    #                         save_dir="./pre.jpg",
    #                         device=device)
    results = model(input_folder)


    t2 = time.time()
    print("预测时间：", t2 - t1)
